﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using FM.录音.Services;
using FM.录音.ViewModels;
using FM.录音.接口;
using Microsoft.Practices.Prism.Mvvm;

namespace FM.录音.Views
{
    /// <summary>
    /// 录音视图组.xaml 的交互逻辑
    /// </summary>
    public partial class 录音视图组 : UserControl, IView
    {
        public 录音视图组()
        {
            InitializeComponent();
            this.DataContextChanged += 录音视图组_DataContextChanged;
        }

        void 录音视图组_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {

            var r = this.DataContext as I子视图;
            if (r == null)
            {
                return;
            }
            if (r.子视图列表.Count == 0)
            {
                return;
            }
            var c = r.子视图列表.Count;
            for (int i = 0; i < c; i++)
            {
                Grid.ColumnDefinitions.Add(new ColumnDefinition());
                var 视图3 = r.子视图列表[i];
                Grid.SetColumn(视图3, i);
                Grid.Children.Add(视图3);
            }

        }
    }
}
